import request from '@/utils/request'
import { download } from '@/api/data'
import { downloadFile } from '@/utils'

export function add(data) {
  return request({
    url: 'api/order/updateOne',
    method: 'post',
    data
  })
}

export function tpfile(data) {
  download('/api/order/template', '').then(result => {
    downloadFile(result, '订单导入模板文件', 'xlsx')
  })
}

export function del(ids) {
  return request({
    url: 'api/order/',
    method: 'delete',
    data: ids
  })
}

export function edit(data) {
  return request({
    url: 'api/order',
    method: 'put',
    data
  })
}

export default { add, edit, del, tpfile }
